package de.tum.in.eist.poll.server;

import java.util.Date;

import com.google.gwt.user.client.Cookies;

public class CookieManager {

	/**
	 * Checks if a certain cookie exists, returns true when a cookie exists 
	 * and false when it doesn't
	 * 
	 * @param identifier The identifier of the ID you want to see the cookie for
	 */
	public static boolean cookieExists(int identifier) {
		if (Cookies.getCookie("EIST_POLL" + identifier) != null)
			return true;
		return false;
	}
	
	/**
	 * Sets a cookie with a given ID
	 * 
	 * @param identifier The identifier of the ID you want to set the cookie for
	 */
	public static boolean setCookie(int identifier)
	{
		Cookies.setCookie("EIST_POLL" + identifier, "EIST_POLL", new Date(2147483647));
		return true;
	}

}
